// index.js

Page({
  /**
   * 页面的初始数据
   */
  data: {
    info: "Hello world",
    imgSrc: 'https://th.bing.com/th/id/R.7ea4753d6773bda61cb368d11e13cf82?rik=vdVocfKWnNtKzA&pid=ImgRaw&r=0',
    randomNum: Math.random() * 10, //生成十以内的数字
    count: 0,
    msg: '你好，',
    type: 3,
    flag: true,
    arr1: ['苹果', '华为', '小米'],
    userList: [{
        id: 1,
        name: "小红"
      },
      {
        id: 2,
        name: "小黄"
      },
      {
        id: 3,
        name: "小白"
      },
    ]
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log("randomNum", this.data.randomNum)
  },

  //定义按钮的事件处理函数
  btnTapHandler(e) {
    console.log('事件对象e:', e)
  },
  //+1按钮的点击事件处理函数
  countChange() {
    this.setData({
      count: this.data.count + 1
    })
  },
  btnTap2(e) {
    this.setData({
      count: this.data.count + e.target.dataset.info
    })
  },
  inputHandler(e) {
    console.log(e.detail.value)
    this.setData({
      msg: e.detail.value
    })
  },

})